/**
 * Demonstrates a range of Button options the framework offers out of the box
 */
Ext.define('cloud.view.coupon.CouponRuleAdd', {
    extend: 'Ext.form.FormPanel',
    xtype: 'couponruleadd',

    requires: ['Ext.form.Panel', 'Ext.form.FieldSet','Ext.field.DatePicker', 'Ext.field.Select', 'Ext.field.Hidden'],
    config: {
        //style:'font-size:14px',
        title: '添加规则',
        items: [
            {
                xtype: 'toolbar',
                docked: 'bottom',
                layout: {
                    type: 'hbox',
                    pack: 'end'
                },
                items: [
                    {
                        id: 'conpon_rule_submit',
                        iconMask: true,
                        scope: this,
                        cls:'x-button2',
                        text: '提交',
                        style: 'float:right'
                    }
                ]
            },
            {
                xtype: 'fieldset',
                //title: '新增应用',
                defaults: {
                    labelwidth: '20%',
                    xtype: 'textfield',
                    required: true,
                    clearIcon: true
                },
                items: [
                    {
                        xtype: 'selectfield',
                        id: 'type',
                        name: 'type',
                        label: '优惠方式',
                        options: [
                            {
                                text: '代金',
                                value: '代金'
                            },
                            {
                                text: '折扣',
                                value: '换购'
                            },
                            {
                                text: '换购',
                                value: '换购'
                            }
                        ]
                    },
                    {
                        xtype: 'datepickerfield',
                        label: '过期时间',
                        id:'conpon_time',
                        name:'time',
                        dateFormat: 'Y-m-d',
                        value: new Date(),
                        picker: {
                            yearFrom: (new Date().getFullYear() - 5),
                            yearTo: (new Date().getFullYear() + 5),
                            slotOrder: ['year', 'month', 'day'],
                            doneButton: {text: '完成'},
                            cancelButton: {text: '取消'}
                        }
                    },
                    {
                        xtype: 'textareafield',
                        id: 'rule',
                        name: 'rule',
                        maxLength: 1000,
                        maxRows: 10,
                        label: '规则描述',
                        required: true,
                        clearIcon: false
                    },
                    {
                        id: 'event',
                        name: 'event',
                        label: '事件',
                        maxLength: 50,
                        placeHolder: '例如：注册/分享'
                    }
                ]
            }
        ]
    }
});